﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Controls="clr-namespace:System.Windows.Controls">

	<Style TargetType="{x:Type Controls:TreeViewEx}">
		<Style.Triggers>
			<Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="True">
				<Setter Property="ItemsControl.ItemsPanel">
					<Setter.Value>
						<ItemsPanelTemplate>
							<VirtualizingStackPanel IsItemsHost="True" />
						</ItemsPanelTemplate>
					</Setter.Value>
				</Setter>
			</Trigger>
		</Style.Triggers>
		<Style.Resources>
			<ResourceDictionary />
		</Style.Resources>
		<Setter Property="Panel.Background">
			<Setter.Value>
				<DynamicResource ResourceKey="{x:Static SystemColors.WindowBrushKey}" />
			</Setter.Value>
		</Setter>
		<Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="False" />
		<Setter Property="Border.BorderBrush" Value="#FF828790" />
		<Setter Property="Border.BorderThickness" Value="1" />
		<Setter Property="Control.Padding" Value="1" />
		<Setter Property="TextElement.Foreground">
			<Setter.Value>
				<DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
			</Setter.Value>
		</Setter>
		<Setter Property="ScrollViewer.HorizontalScrollBarVisibility">
			<Setter.Value>
				<x:Static Member="ScrollBarVisibility.Auto" />
			</Setter.Value>
		</Setter>
		<Setter Property="ScrollViewer.VerticalScrollBarVisibility">
			<Setter.Value>
				<x:Static Member="ScrollBarVisibility.Auto" />
			</Setter.Value>
		</Setter>
		<Setter Property="Control.VerticalContentAlignment">
			<Setter.Value>
				<x:Static Member="VerticalAlignment.Center" />
			</Setter.Value>
		</Setter>
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Controls:TreeViewEx}">
					<Border BorderThickness="{TemplateBinding Border.BorderThickness}"
                            BorderBrush="{TemplateBinding Border.BorderBrush}" Name="Bd" SnapsToDevicePixels="True">
						<ScrollViewer CanContentScroll="True"
							HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
							VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
							Background="{TemplateBinding Panel.Background}"
							Padding="{TemplateBinding Control.Padding}" DockPanel.Dock="Top"
							SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" Focusable="False">
							<ItemsPresenter x:Name="content" />
						</ScrollViewer>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="UIElement.IsEnabled" Value="False">
							<Setter Property="Panel.Background" TargetName="Bd">
								<Setter.Value>
									<DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>